package com.leyou.item.mapper;

import com.leyou.item.pojo.Sku;
import com.leyou.common.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * @ClassName SkuMapper
 * @Date 2019/2/14 11:25
 */
public interface SkuMapper extends BaseMapper<Sku> {

    @Update("update tb_stock set stock = stock - #{num} where sku_id = #{id} and stock >= #{num}")
    int decreaseStock(@Param("num") Integer num, @Param("id") Long id);
}
